import java.io.*;
import java.net.*;

class PServerThread extends Thread {
    private Server serverObj;

    public PServerThread(Server serverObj) {
	super("PServer Thread");
	this.serverObj = serverObj;
    }

    public void run() {
	try {
	    int count = 0;
	    while(true) {
		Socket clientSocket = this.serverObj.serverSocket.accept();
		
		//Integer count = this.clientSockets.length;
		String remoteIp = clientSocket.getInetAddress().getHostAddress();
		this.serverObj.remoteIps[count] = remoteIp;

		this.serverObj.clientSockets[count] = clientSocket;
		count++;
		
		this.serverObj.createSocketThread(clientSocket);
	    }	    
	} catch(Exception e) {
	    e.printStackTrace();
	}
    }
}